﻿using TouchFish.UI;
using UnityEngine;

public class TestA : UIPanel
{
    private TestAMediator _testAMediator;

    protected override void InitSelfPanelInfoAndSelfPanelType()
    {
    }

    protected override void RegisterMediator()
    {
        if (_testAMediator == null)
        {
            _testAMediator = new TestAMediator(this);
        }
        SelfFacade.RegisterMediator(_testAMediator);
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q))
        {
            RemoveMediator();
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            RegisterMediator();
        }
    }

    protected override void RemoveMediator()
    {
        SelfFacade.RemoveMediator(_testAMediator.MediatorId);
    }

    public void ButtonClick()
    {
        Debug.Log("ButtonClick");
        SelfFacade.SendNotification(UINotificationId.TestA1);
    }
}